package Base.ThisTest;

import lombok.extern.slf4j.Slf4j;

public class ThisUse {
    public static void main(String[] args) {
        Person1 person = new Person1();
        person.setAge(12);
        person.setName("枫城");
        System.out.println(person.toString());

        Person1 花海 = new Person1("花海", 12);
        System.out.println(花海.toString());
    }
}

@Slf4j
class Person1{
    private String name;
    private int age;

    public Person1() {
    }

    public Person1(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        log.info("对象----》 {}\t{}", this.name, this.age);
        return "{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
